package com.example.demo;

import com.example.demo.exception.ExceptionHandler;
import de.felixroske.jfxsupport.AbstractFxmlView;
import de.felixroske.jfxsupport.AbstractJavaFxApplicationSupport;
import de.felixroske.jfxsupport.FXMLView;
import de.felixroske.jfxsupport.SplashScreen;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
@Slf4j
public class AppStarter extends AbstractJavaFxApplicationSupport {

    public static void main(String[] args) {
        // 全局异常处理
        Thread.setDefaultUncaughtExceptionHandler((t, e) -> new ExceptionHandler().setE(e).handle());

        launch(AppStarter.class, MainView.class, new MySplash(), args);
    }

    /**
     * 启动页
     */
    public static class MySplash extends SplashScreen {

        @Override
        public String getImagePath() {
            return "/image/0.png";
        }

        @Override
        public boolean visible() {
            return super.visible();
        }
    }

    /**
     * 主窗体
     */
    @FXMLView(value = "/fxml/main.fxml")
    public static class MainView extends AbstractFxmlView {}

}
